package cn.school.student.service;

import cn.school.basics.vo.DormitoryBerthVO;
import cn.school.classManage.vo.SchoolClassVO;
import cn.school.common.api.CommonPage;
import cn.school.common.api.CommonResult;
import cn.school.common.exception.ApiException;
import cn.school.student.entity.StudentInfo;
import cn.school.student.entity.vo.DeviceStudentExcel;
import cn.school.student.entity.vo.ExamPublishParam;
import cn.school.student.entity.vo.StudentInfoExcel;
import cn.school.student.entity.vo.StudentInfoVo;
import cn.school.student.param.StudentInfoPageParam;
import cn.school.student.param.StudentQueryByClassDTO;
import cn.school.student.vo.StudentContactsImportVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

public interface StudentInfoService extends IService<StudentInfo>{

    CommonResult<Long> enterStudent(StudentInfo studentInfo);

    CommonResult<CommonPage<StudentInfo>> getStudentInfoPage(StudentInfoPageParam studentInfoPageParam);

    CommonResult<Integer> deleteStudentInfo(Long id);

    CommonResult<Integer> updateStudent(StudentInfo studentInfo);


    CommonResult<Integer> updateBatchStudent(List<StudentInfo> studentInfo);

    CommonResult<StudentInfo> getStudentInfoById(Long id);

    CommonResult<Integer> importStudentInfoFromExcel(MultipartFile multipartFile) throws IOException, ApiException;

    IPage<StudentInfo> findStudentInfoByClass(StudentQueryByClassDTO queryDTO);

    String login(String username, String password, HttpServletRequest request);

	UserDetails loadStudentInfoByPhone(String phone);

    UserDetails loadParentInfoByPhone(String phone);

	int updatePasswordByStudentId(Long id, String newPass);

    void resetPwd(Long id);

    void parentResetPwd(Long id);

    List<SchoolClassVO> allSchoolClass();

    /**
     * 查询学生学费
     * @param classId
     * @return
     */
    String findTuitionFeeByClassId(Long classId);

    /**
     * 修改单个学生信息
     * @param info
     * @return
     */
    int updateStudentInfo(StudentInfo info);

    /**
     * 家长登录
     *
     * @author fangjin.tao
     * @param: username
     * @param: password
     * @param: request
     * @updateTime 2023/2/16 8:35
     * @return: java.lang.String
     * @throws
     */
	String loginByParentUser(String username, String password, HttpServletRequest request);

    /**
     * 修改监护人密码
     *
     * @author fangjin.tao
     * @updateTime 2023/2/16 9:47
     * @throws
     */
    int updatePasswordByParentId(Long id, String newPass);

    List<StudentInfoVo> queryList(ExamPublishParam examPublishParam);

    /**
     * 批量删除学生信息
     *
     * @author wankeqiu
     * @param: list 学生信息
     * @updateTime 2023/3/9 10:10
     * @return: int
     */
    int deleteBatchStudentInfo(List<StudentInfo> list);

    /**
     * 批量重置学生密码
     * @author wankeqiu
     * @param: list
     * @updateTime 2023/3/10 11:16
     */
    int batchResetStudentsPwd(List<StudentInfo> list);

    /**
     * 批量重置监护人密码
     * @author wankeqiu
     * @param: list
     * @updateTime 2023/3/10 11:17
     */
    int batchResetParentsPwd(List<StudentInfo> list);

    /**
     * 通过班级id批量查询学生信息
     * @author alex
     * @param: classIds
     * @date 2023/3/30 14:36
     * @return
     */
    List<StudentInfo> getStudentInfosByClassIds(List<Long> classIds);

    /**
     * 通过班级id查询学生列表
     */
    List<StudentInfo> findStudentListByClassId(Long classId);

    /**
     * 查询班级中的学生
     * @param list
     * @return
     */
    List<StudentInfo> getClassInStudent(List<StudentContactsImportVO> list);

    /**
     * 导入学生照片信息
     * @author alex
     * @param: multipartFile
     * @date 2023/5/19 10:52
     * @return
     */
	CommonResult<Integer> importStudentPictureExcel(MultipartFile multipartFile) throws IOException;

    CommonResult<Integer> updateByStudentId(StudentInfo studentInfo);
    List<StudentInfo> listByClass(String classId);

    StudentInfo getStudentInfo(String id);


    /**
     * 查询租户下的全部学生,导出照片用
     * @return
     */
    List<DeviceStudentExcel> findStudentAll(StudentInfo studentInfo);

    /**
     * 导出学生信息
     * @param studentInfo
     * @return
     */
    List<StudentInfoExcel> studentByTenantIdExportList(StudentInfo studentInfo);


    /**
     * 学生退宿
     * @param vo
     * @return
     */
    int studentRetreat(DormitoryBerthVO vo);
}
